home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / share / gettext / intl / plural.c < prev    next >
Encoding:
C/C++ Source or Header  |  2007-03-05  |  36.5 KB  |  1,493 lines

  1. /* A Bison parser, made from plural.y
  2.    by GNU bison 1.35.  */
  3.  
  4. #define YYBISON 1  /* Identify Bison output.  */
  5.  
  6. #define yyparse __gettextparse
  7. #define yylex __gettextlex
  8. #define yyerror __gettexterror
  9. #define yylval __gettextlval
  10. #define yychar __gettextchar
  11. #define yydebug __gettextdebug
  12. #define yynerrs __gettextnerrs
  13. # define    EQUOP2    257
  14. # define    CMPOP2    258
  15. # define    ADDOP2    259
  16. # define    MULOP2    260
  17. # define    NUMBER    261
  18.  
  19. #line 1 "plural.y"
  20.  
  21. /* Expression parsing for plural form selection.
  22.    Copyright (C) 2000-2001, 2003, 2005 Free Software Foundation, Inc.
  23.    Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
  24.  
  25.    This program is free software; you can redistribute it and/or modify it
  26.    under the terms of the GNU Library General Public License as published
  27.    by the Free Software Foundation; either version 2, or (at your option)
  28.    any later version.
  29.  
  30.    This program is distributed in the hope that it will be useful,
  31.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  32.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  33.    Library General Public License for more details.
  34.  
  35.    You should have received a copy of the GNU Library General Public
  36.    License along with this program; if not, write to the Free Software
  37.    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
  38.    USA.  */
  39.  
  40. /* For bison < 2.0, the bison generated parser uses alloca.  AIX 3 forces us
  41.    to put this declaration at the beginning of the file.  The declaration in
  42.    bison's skeleton file comes too late.  This must come before <config.h>
  43.    because <config.h> may include arbitrary system headers.
  44.    This can go away once the AM_INTL_SUBDIR macro requires bison >= 2.0.  */
  45. #if defined _AIX && !defined __GNUC__
  46.  #pragma alloca
  47. #endif
  48.  
  49. #ifdef HAVE_CONFIG_H
  50. # include <config.h>
  51. #endif
  52.  
  53. #include <stddef.h>
  54. #include <stdlib.h>
  55. #include <string.h>
  56. #include "plural-exp.h"
  57.  
  58. /* The main function generated by the parser is called __gettextparse,
  59.    but we want it to be called PLURAL_PARSE.  */
  60. #ifndef _LIBC
  61. # define __gettextparse PLURAL_PARSE
  62. #endif
  63.  
  64. #define YYLEX_PARAM    &((struct parse_args *) arg)->cp
  65. #define YYPARSE_PARAM    arg
  66.  
  67. #line 51 "plural.y"
  68. #ifndef YYSTYPE
  69. typedef union {
  70.   unsigned long int num;
  71.   enum operator op;
  72.   struct expression *exp;
  73. } yystype;
  74. # define YYSTYPE yystype
  75. # define YYSTYPE_IS_TRIVIAL 1
  76. #endif
  77. #line 57 "plural.y"
  78.  
  79. /* Prototypes for local functions.  */
  80. static int yylex (YYSTYPE *lval, const char **pexp);
  81. static void yyerror (const char *str);
  82.  
  83. /* Allocation of expressions.  */
  84.  
  85. static struct expression *
  86. new_exp (int nargs, enum operator op, struct expression * const *args)
  87. {
  88.   int i;
  89.   struct expression *newp;
  90.  
  91.   /* If any of the argument could not be malloc'ed, just return NULL.  */
  92.   for (i = nargs - 1; i >= 0; i--)
  93.     if (args[i] == NULL)
  94.       goto fail;
  95.  
  96.   /* Allocate a new expression.  */
  97.   newp = (struct expression *) malloc (sizeof (*newp));
  98.   if (newp != NULL)
  99.     {
  100.       newp->nargs = nargs;
  101.       newp->operation = op;
  102.       for (i = nargs - 1; i >= 0; i--)
  103.     newp->val.args[i] = args[i];
  104.       return newp;
  105.     }
  106.  
  107.  fail:
  108.   for (i = nargs - 1; i >= 0; i--)
  109.     FREE_EXPRESSION (args[i]);
  110.  
  111.   return NULL;
  112. }
  113.  
  114. static inline struct expression *
  115. new_exp_0 (enum operator op)
  116. {
  117.   return new_exp (0, op, NULL);
  118. }
  119.  
  120. static inline struct expression *
  121. new_exp_1 (enum operator op, struct expression *right)
  122. {
  123.   struct expression *args[1];
  124.  
  125.   args[0] = right;
  126.   return new_exp (1, op, args);
  127. }
  128.  
  129. static struct expression *
  130. new_exp_2 (enum operator op, struct expression *left, struct expression *right)
  131. {
  132.   struct expression *args[2];
  133.  
  134.   args[0] = left;
  135.   args[1] = right;
  136.   return new_exp (2, op, args);
  137. }
  138.  
  139. static inline struct expression *
  140. new_exp_3 (enum operator op, struct expression *bexp,
  141.        struct expression *tbranch, struct expression *fbranch)
  142. {
  143.   struct expression *args[3];
  144.  
  145.   args[0] = bexp;
  146.   args[1] = tbranch;
  147.   args[2] = fbranch;
  148.   return new_exp (3, op, args);
  149. }
  150.  
  151. #ifndef YYDEBUG
  152. # define YYDEBUG 0
  153. #endif
  154.  
  155.  
  156.  
  157. #define    YYFINAL        27
  158. #define    YYFLAG        -32768
  159. #define    YYNTBASE    16
  160.  
  161. /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
  162. #define YYTRANSLATE(x) ((unsigned)(x) <= 261 ? yytranslate[x] : 18)
  163.  
  164. /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
  165. static const char yytranslate[] =
  166. {
  167.        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  168.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  169.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  170.        2,     2,     2,    10,     2,     2,     2,     2,     5,     2,
  171.       14,    15,     2,     2,     2,     2,     2,     2,     2,     2,
  172.        2,     2,     2,     2,     2,     2,     2,     2,    12,     2,
  173.        2,     2,     2,     3,     2,     2,     2,     2,     2,     2,
  174.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  175.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  176.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  177.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  178.       13,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  179.        2,     2,     2,     2,     4,     2,     2,     2,     2,     2,
  180.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  181.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  182.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  183.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  184.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  185.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  186.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  187.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  188.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  189.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  190.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  191.        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  192.        2,     2,     2,     2,     2,     2,     1,     6,     7,     8,
  193.        9,    11
  194. };
  195.  
  196. #if YYDEBUG
  197. static const short yyprhs[] =
  198. {
  199.        0,     0,     2,     8,    12,    16,    20,    24,    28,    32,
  200.       35,    37,    39
  201. };
  202. static const short yyrhs[] =
  203. {
  204.       17,     0,    17,     3,    17,    12,    17,     0,    17,     4,
  205.       17,     0,    17,     5,    17,     0,    17,     6,    17,     0,
  206.       17,     7,    17,     0,    17,     8,    17,     0,    17,     9,
  207.       17,     0,    10,    17,     0,    13,     0,    11,     0,    14,
  208.       17,    15,     0
  209. };
  210.  
  211. #endif
  212.  
  213. #if YYDEBUG
  214. /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
  215. static const short yyrline[] =
  216. {
  217.        0,   152,   160,   164,   168,   172,   176,   180,   184,   188,
  218.      192,   196,   201
  219. };
  220. #endif
  221.  
  222.  
  223. #if (YYDEBUG) || defined YYERROR_VERBOSE
  224.  
  225. /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
  226. static const char *const yytname[] =
  227. {
  228.   "$", "error", "$undefined.", "'?'", "'|'", "'&'", "EQUOP2", "CMPOP2", 
  229.   "ADDOP2", "MULOP2", "'!'", "NUMBER", "':'", "'n'", "'('", "')'", 
  230.   "start", "exp", 0
  231. };
  232. #endif
  233.  
  234. /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
  235. static const short yyr1[] =
  236. {
  237.        0,    16,    17,    17,    17,    17,    17,    17,    17,    17,
  238.       17,    17,    17
  239. };
  240.  
  241. /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
  242. static const short yyr2[] =
  243. {
  244.        0,     1,     5,     3,     3,     3,     3,     3,     3,     2,
  245.        1,     1,     3
  246. };
  247.  
  248. /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
  249.    doesn't specify something else to do.  Zero means the default is an
  250.    error. */
  251. static const short yydefact[] =
  252. {
  253.        0,     0,    11,    10,     0,     1,     9,     0,     0,     0,
  254.        0,     0,     0,     0,     0,    12,     0,     3,     4,     5,
  255.        6,     7,     8,     0,     2,     0,     0,     0
  256. };
  257.  
  258. static const short yydefgoto[] =
  259. {
  260.       25,     5
  261. };
  262.  
  263. static const short yypact[] =
  264. {
  265.       -9,    -9,-32768,-32768,    -9,    34,-32768,    11,    -9,    -9,
  266.       -9,    -9,    -9,    -9,    -9,-32768,    24,    39,    43,    16,
  267.       26,    -3,-32768,    -9,    34,    21,    53,-32768
  268. };
  269.  
  270. static const short yypgoto[] =
  271. {
  272.   -32768,    -1
  273. };
  274.  
  275.  
  276. #define    YYLAST        53
  277.  
  278.  
  279. static const short yytable[] =
  280. {
  281.        6,     1,     2,     7,     3,     4,    14,    16,    17,    18,
  282.       19,    20,    21,    22,     8,     9,    10,    11,    12,    13,
  283.       14,    26,    24,    12,    13,    14,    15,     8,     9,    10,
  284.       11,    12,    13,    14,    13,    14,    23,     8,     9,    10,
  285.       11,    12,    13,    14,    10,    11,    12,    13,    14,    11,
  286.       12,    13,    14,    27
  287. };
  288.  
  289. static const short yycheck[] =
  290. {
  291.        1,    10,    11,     4,    13,    14,     9,     8,     9,    10,
  292.       11,    12,    13,    14,     3,     4,     5,     6,     7,     8,
  293.        9,     0,    23,     7,     8,     9,    15,     3,     4,     5,
  294.        6,     7,     8,     9,     8,     9,    12,     3,     4,     5,
  295.        6,     7,     8,     9,     5,     6,     7,     8,     9,     6,
  296.        7,     8,     9,     0
  297. };
  298. #define YYPURE 1
  299.  
  300. /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
  301. #line 3 "bison.simple"
  302.  
  303. /* Skeleton output parser for bison,
  304.  
  305.    Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
  306.    Foundation, Inc.
  307.  
  308.    This program is free software; you can redistribute it and/or modify
  309.    it under the terms of the GNU General Public License as published by
  310.    the Free Software Foundation; either version 2, or (at your option)
  311.    any later version.
  312.  
  313.    This program is distributed in the hope that it will be useful,
  314.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  315.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  316.    GNU General Public License for more details.
  317.  
  318.    You should have received a copy of the GNU General Public License
  319.    along with this program; if not, write to the Free Software
  320.    Foundation, Inc., 59 Temple Place - Suite 330,
  321.    Boston, MA 02111-1307, USA.  */
  322.  
  323. /* As a special exception, when this file is copied by Bison into a
  324.    Bison output file, you may use that output file without restriction.
  325.    This special exception was added by the Free Software Foundation
  326.    in version 1.24 of Bison.  */
  327.  
  328. /* This is the parser code that is written into each bison parser when
  329.    the %semantic_parser declaration is not specified in the grammar.
  330.    It was written by Richard Stallman by simplifying the hairy parser
  331.    used when %semantic_parser is specified.  */
  332.  
  333. /* All symbols defined below should begin with yy or YY, to avoid
  334.    infringing on user name space.  This should be done even for local
  335.    variables, as they might otherwise be expanded by user macros.
  336.    There are some unavoidable exceptions within include files to
  337.    define necessary library symbols; they are noted "INFRINGES ON
  338.    USER NAME SPACE" below.  */
  339.  
  340. #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
  341.  
  342. /* The parser invokes alloca or malloc; define the necessary symbols.  */
  343.  
  344. # if YYSTACK_USE_ALLOCA
  345. #  define YYSTACK_ALLOC alloca
  346. # else
  347. #  ifndef YYSTACK_USE_ALLOCA
  348. #   if defined (alloca) || defined (_ALLOCA_H)
  349. #    define YYSTACK_ALLOC alloca
  350. #   else
  351. #    ifdef __GNUC__
  352. #     define YYSTACK_ALLOC __builtin_alloca
  353. #    endif
  354. #   endif
  355. #  endif
  356. # endif
  357.  
  358. # ifdef YYSTACK_ALLOC
  359.    /* Pacify GCC's `empty if-body' warning. */
  360. #  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
  361. # else
  362. #  if defined (__STDC__) || defined (__cplusplus)
  363. #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
  364. #   define YYSIZE_T size_t
  365. #  endif
  366. #  define YYSTACK_ALLOC malloc
  367. #  define YYSTACK_FREE free
  368. # endif
  369. #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
  370.  
  371.  
  372. #if (! defined (yyoverflow) \
  373.      && (! defined (__cplusplus) \
  374.      || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
  375.  
  376. /* A type that is properly aligned for any stack member.  */
  377. union yyalloc
  378. {
  379.   short yyss;
  380.   YYSTYPE yyvs;
  381. # if YYLSP_NEEDED
  382.   YYLTYPE yyls;
  383. # endif
  384. };
  385.  
  386. /* The size of the maximum gap between one aligned stack and the next.  */
  387. # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
  388.  
  389. /* The size of an array large to enough to hold all stacks, each with
  390.    N elements.  */
  391. # if YYLSP_NEEDED
  392. #  define YYSTACK_BYTES(N) \
  393.      ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE))    \
  394.       + 2 * YYSTACK_GAP_MAX)
  395. # else
  396. #  define YYSTACK_BYTES(N) \
  397.      ((N) * (sizeof (short) + sizeof (YYSTYPE))                \
  398.       + YYSTACK_GAP_MAX)
  399. # endif
  400.  
  401. /* Copy COUNT objects from FROM to TO.  The source and destination do
  402.    not overlap.  */
  403. # ifndef YYCOPY
  404. #  if 1 < __GNUC__
  405. #   define YYCOPY(To, From, Count) \
  406.       __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
  407. #  else
  408. #   define YYCOPY(To, From, Count)        \
  409.       do                    \
  410.     {                    \
  411.       register YYSIZE_T yyi;        \
  412.       for (yyi = 0; yyi < (Count); yyi++)    \
  413.         (To)[yyi] = (From)[yyi];        \
  414.     }                    \
  415.       while (0)
  416. #  endif
  417. # endif
  418.  
  419. /* Relocate STACK from its old location to the new one.  The
  420.    local variables YYSIZE and YYSTACKSIZE give the old and new number of
  421.    elements in the stack, and YYPTR gives the new location of the
  422.    stack.  Advance YYPTR to a properly aligned location for the next
  423.    stack.  */
  424. # define YYSTACK_RELOCATE(Stack)                    \
  425.     do                                    \
  426.       {                                    \
  427.     YYSIZE_T yynewbytes;                        \
  428.     YYCOPY (&yyptr->Stack, Stack, yysize);                \
  429.     Stack = &yyptr->Stack;                        \
  430.     yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX;    \
  431.     yyptr += yynewbytes / sizeof (*yyptr);                \
  432.       }                                    \
  433.     while (0)
  434.  
  435. #endif
  436.  
  437.  
  438. #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
  439. # define YYSIZE_T __SIZE_TYPE__
  440. #endif
  441. #if ! defined (YYSIZE_T) && defined (size_t)
  442. # define YYSIZE_T size_t
  443. #endif
  444. #if ! defined (YYSIZE_T)
  445. # if defined (__STDC__) || defined (__cplusplus)
  446. #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
  447. #  define YYSIZE_T size_t
  448. # endif
  449. #endif
  450. #if ! defined (YYSIZE_T)
  451. # define YYSIZE_T unsigned int
  452. #endif
  453.  
  454. #define yyerrok        (yyerrstatus = 0)
  455. #define yyclearin    (yychar = YYEMPTY)
  456. #define YYEMPTY        -2
  457. #define YYEOF        0
  458. #define YYACCEPT    goto yyacceptlab
  459. #define YYABORT     goto yyabortlab
  460. #define YYERROR        goto yyerrlab1
  461. /* Like YYERROR except do call yyerror.  This remains here temporarily
  462.    to ease the transition to the new meaning of YYERROR, for GCC.
  463.    Once GCC version 2 has supplanted version 1, this can go.  */
  464. #define YYFAIL        goto yyerrlab
  465. #define YYRECOVERING()  (!!yyerrstatus)
  466. #define YYBACKUP(Token, Value)                    \
  467. do                                \
  468.   if (yychar == YYEMPTY && yylen == 1)                \
  469.     {                                \
  470.       yychar = (Token);                        \
  471.       yylval = (Value);                        \
  472.       yychar1 = YYTRANSLATE (yychar);                \
  473.       YYPOPSTACK;                        \
  474.       goto yybackup;                        \
  475.     }                                \
  476.   else                                \
  477.     {                                 \
  478.       yyerror ("syntax error: cannot back up");            \
  479.       YYERROR;                            \
  480.     }                                \
  481. while (0)
  482.  
  483. #define YYTERROR    1
  484. #define YYERRCODE    256
  485.  
  486.  
  487. /* YYLLOC_DEFAULT -- Compute the default location (before the actions
  488.    are run).
  489.  
  490.    When YYLLOC_DEFAULT is run, CURRENT is set the location of the
  491.    first token.  By default, to implement support for ranges, extend
  492.    its range to the last symbol.  */
  493.  
  494. #ifndef YYLLOC_DEFAULT
  495. # define YYLLOC_DEFAULT(Current, Rhs, N)           \
  496.    Current.last_line   = Rhs[N].last_line;    \
  497.    Current.last_column = Rhs[N].last_column;
  498. #endif
  499.  
  500.  
  501. /* YYLEX -- calling `yylex' with the right arguments.  */
  502.  
  503. #if YYPURE
  504. # if YYLSP_NEEDED
  505. #  ifdef YYLEX_PARAM
  506. #   define YYLEX        yylex (&yylval, &yylloc, YYLEX_PARAM)
  507. #  else
  508. #   define YYLEX        yylex (&yylval, &yylloc)
  509. #  endif
  510. # else /* !YYLSP_NEEDED */
  511. #  ifdef YYLEX_PARAM
  512. #   define YYLEX        yylex (&yylval, YYLEX_PARAM)
  513. #  else
  514. #   define YYLEX        yylex (&yylval)
  515. #  endif
  516. # endif /* !YYLSP_NEEDED */
  517. #else /* !YYPURE */
  518. # define YYLEX            yylex ()
  519. #endif /* !YYPURE */
  520.  
  521.  
  522. /* Enable debugging if requested.  */
  523. #if YYDEBUG
  524.  
  525. # ifndef YYFPRINTF
  526. #  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
  527. #  define YYFPRINTF fprintf
  528. # endif
  529.  
  530. # define YYDPRINTF(Args)            \
  531. do {                        \
  532.   if (yydebug)                    \
  533.     YYFPRINTF Args;                \
  534. } while (0)
  535. /* Nonzero means print parse trace.  It is left uninitialized so that
  536.    multiple parsers can coexist.  */
  537. int yydebug;
  538. #else /* !YYDEBUG */
  539. # define YYDPRINTF(Args)
  540. #endif /* !YYDEBUG */
  541.  
  542. /* YYINITDEPTH -- initial size of the parser's stacks.  */
  543. #ifndef    YYINITDEPTH
  544. # define YYINITDEPTH 200
  545. #endif
  546.  
  547. /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
  548.    if the built-in stack extension method is used).
  549.  
  550.    Do not make this value too large; the results are undefined if
  551.    SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
  552.    evaluated with infinite-precision integer arithmetic.  */
  553.  
  554. #if YYMAXDEPTH == 0
  555. # undef YYMAXDEPTH
  556. #endif
  557.  
  558. #ifndef YYMAXDEPTH
  559. # define YYMAXDEPTH 10000
  560. #endif
  561.  
  562. #ifdef YYERROR_VERBOSE
  563.  
  564. # ifndef yystrlen
  565. #  if defined (__GLIBC__) && defined (_STRING_H)
  566. #   define yystrlen strlen
  567. #  else
  568. /* Return the length of YYSTR.  */
  569. static YYSIZE_T
  570. #   if defined (__STDC__) || defined (__cplusplus)
  571. yystrlen (const char *yystr)
  572. #   else
  573. yystrlen (yystr)
  574.      const char *yystr;
  575. #   endif
  576. {
  577.   register const char *yys = yystr;
  578.  
  579.   while (*yys++ != '\0')
  580.     continue;
  581.  
  582.   return yys - yystr - 1;
  583. }
  584. #  endif
  585. # endif
  586.  
  587. # ifndef yystpcpy
  588. #  if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
  589. #   define yystpcpy stpcpy
  590. #  else
  591. /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
  592.    YYDEST.  */
  593. static char *
  594. #   if defined (__STDC__) || defined (__cplusplus)
  595. yystpcpy (char *yydest, const char *yysrc)
  596. #   else
  597. yystpcpy (yydest, yysrc)
  598.      char *yydest;
  599.      const char *yysrc;
  600. #   endif
  601. {
  602.   register char *yyd = yydest;
  603.   register const char *yys = yysrc;
  604.  
  605.   while ((*yyd++ = *yys++) != '\0')
  606.     continue;
  607.  
  608.   return yyd - 1;
  609. }
  610. #  endif
  611. # endif
  612. #endif
  613.  
  614. #line 315 "bison.simple"
  615.  
  616.  
  617. /* The user can define YYPARSE_PARAM as the name of an argument to be passed
  618.    into yyparse.  The argument should have type void *.
  619.    It should actually point to an object.
  620.    Grammar actions can access the variable by casting it
  621.    to the proper pointer type.  */
  622.  
  623. #ifdef YYPARSE_PARAM
  624. # if defined (__STDC__) || defined (__cplusplus)
  625. #  define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
  626. #  define YYPARSE_PARAM_DECL
  627. # else
  628. #  define YYPARSE_PARAM_ARG YYPARSE_PARAM
  629. #  define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
  630. # endif
  631. #else /* !YYPARSE_PARAM */
  632. # define YYPARSE_PARAM_ARG
  633. # define YYPARSE_PARAM_DECL
  634. #endif /* !YYPARSE_PARAM */
  635.  
  636. /* Prevent warning if -Wstrict-prototypes.  */
  637. #ifdef __GNUC__
  638. # ifdef YYPARSE_PARAM
  639. int yyparse (void *);
  640. # else
  641. int yyparse (void);
  642. # endif
  643. #endif
  644.  
  645. /* YY_DECL_VARIABLES -- depending whether we use a pure parser,
  646.    variables are global, or local to YYPARSE.  */
  647.  
  648. #define YY_DECL_NON_LSP_VARIABLES            \
  649. /* The lookahead symbol.  */                \
  650. int yychar;                        \
  651.                             \
  652. /* The semantic value of the lookahead symbol. */    \
  653. YYSTYPE yylval;                        \
  654.                             \
  655. /* Number of parse errors so far.  */            \
  656. int yynerrs;
  657.  
  658. #if YYLSP_NEEDED
  659. # define YY_DECL_VARIABLES            \
  660. YY_DECL_NON_LSP_VARIABLES            \
  661.                         \
  662. /* Location data for the lookahead symbol.  */    \
  663. YYLTYPE yylloc;
  664. #else
  665. # define YY_DECL_VARIABLES            \
  666. YY_DECL_NON_LSP_VARIABLES
  667. #endif
  668.  
  669.  
  670. /* If nonreentrant, generate the variables here. */
  671.  
  672. #if !YYPURE
  673. YY_DECL_VARIABLES
  674. #endif  /* !YYPURE */
  675.  
  676. int
  677. yyparse (YYPARSE_PARAM_ARG)
  678.      YYPARSE_PARAM_DECL
  679. {
  680.   /* If reentrant, generate the variables here. */
  681. #if YYPURE
  682.   YY_DECL_VARIABLES
  683. #endif  /* !YYPURE */
  684.  
  685.   register int yystate;
  686.   register int yyn;
  687.   int yyresult;
  688.   /* Number of tokens to shift before error messages enabled.  */
  689.   int yyerrstatus;
  690.   /* Lookahead token as an internal (translated) token number.  */
  691.   int yychar1 = 0;
  692.  
  693.   /* Three stacks and their tools:
  694.      `yyss': related to states,
  695.      `yyvs': related to semantic values,
  696.      `yyls': related to locations.
  697.  
  698.      Refer to the stacks thru separate pointers, to allow yyoverflow
  699.      to reallocate them elsewhere.  */
  700.  
  701.   /* The state stack. */
  702.   short    yyssa[YYINITDEPTH];
  703.   short *yyss = yyssa;
  704.   register short *yyssp;
  705.  
  706.   /* The semantic value stack.  */
  707.   YYSTYPE yyvsa[YYINITDEPTH];
  708.   YYSTYPE *yyvs = yyvsa;
  709.   register YYSTYPE *yyvsp;
  710.  
  711. #if YYLSP_NEEDED
  712.   /* The location stack.  */
  713.   YYLTYPE yylsa[YYINITDEPTH];
  714.   YYLTYPE *yyls = yylsa;
  715.   YYLTYPE *yylsp;
  716. #endif
  717.  
  718. #if YYLSP_NEEDED
  719. # define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
  720. #else
  721. # define YYPOPSTACK   (yyvsp--, yyssp--)
  722. #endif
  723.  
  724.   YYSIZE_T yystacksize = YYINITDEPTH;
  725.  
  726.  
  727.   /* The variables used to return semantic value and location from the
  728.      action routines.  */
  729.   YYSTYPE yyval;
  730. #if YYLSP_NEEDED
  731.   YYLTYPE yyloc;
  732. #endif
  733.  
  734.   /* When reducing, the number of symbols on the RHS of the reduced
  735.      rule. */
  736.   int yylen;
  737.  
  738.   YYDPRINTF ((stderr, "Starting parse\n"));
  739.  
  740.   yystate = 0;
  741.   yyerrstatus = 0;
  742.   yynerrs = 0;
  743.   yychar = YYEMPTY;        /* Cause a token to be read.  */
  744.  
  745.   /* Initialize stack pointers.
  746.      Waste one element of value and location stack
  747.      so that they stay on the same level as the state stack.
  748.      The wasted elements are never initialized.  */
  749.  
  750.   yyssp = yyss;
  751.   yyvsp = yyvs;
  752. #if YYLSP_NEEDED
  753.   yylsp = yyls;
  754. #endif
  755.   goto yysetstate;
  756.  
  757. /*------------------------------------------------------------.
  758. | yynewstate -- Push a new state, which is found in yystate.  |
  759. `------------------------------------------------------------*/
  760.  yynewstate:
  761.   /* In all cases, when you get here, the value and location stacks
  762.      have just been pushed. so pushing a state here evens the stacks.
  763.      */
  764.   yyssp++;
  765.  
  766.  yysetstate:
  767.   *yyssp = yystate;
  768.  
  769.   if (yyssp >= yyss + yystacksize - 1)
  770.     {
  771.       /* Get the current used size of the three stacks, in elements.  */
  772.       YYSIZE_T yysize = yyssp - yyss + 1;
  773.  
  774. #ifdef yyoverflow
  775.       {
  776.     /* Give user a chance to reallocate the stack. Use copies of
  777.        these so that the &'s don't force the real ones into
  778.        memory.  */
  779.     YYSTYPE *yyvs1 = yyvs;
  780.     short *yyss1 = yyss;
  781.  
  782.     /* Each stack pointer address is followed by the size of the
  783.        data in use in that stack, in bytes.  */
  784. # if YYLSP_NEEDED
  785.     YYLTYPE *yyls1 = yyls;
  786.     /* This used to be a conditional around just the two extra args,
  787.        but that might be undefined if yyoverflow is a macro.  */
  788.     yyoverflow ("parser stack overflow",
  789.             &yyss1, yysize * sizeof (*yyssp),
  790.             &yyvs1, yysize * sizeof (*yyvsp),
  791.             &yyls1, yysize * sizeof (*yylsp),
  792.             &yystacksize);
  793.     yyls = yyls1;
  794. # else
  795.     yyoverflow ("parser stack overflow",
  796.             &yyss1, yysize * sizeof (*yyssp),
  797.             &yyvs1, yysize * sizeof (*yyvsp),
  798.             &yystacksize);
  799. # endif
  800.     yyss = yyss1;
  801.     yyvs = yyvs1;
  802.       }
  803. #else /* no yyoverflow */
  804. # ifndef YYSTACK_RELOCATE
  805.       goto yyoverflowlab;
  806. # else
  807.       /* Extend the stack our own way.  */
  808.       if (yystacksize >= YYMAXDEPTH)
  809.     goto yyoverflowlab;
  810.       yystacksize *= 2;
  811.       if (yystacksize > YYMAXDEPTH)
  812.     yystacksize = YYMAXDEPTH;
  813.  
  814.       {
  815.     short *yyss1 = yyss;
  816.     union yyalloc *yyptr =
  817.       (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
  818.     if (! yyptr)
  819.       goto yyoverflowlab;
  820.     YYSTACK_RELOCATE (yyss);
  821.     YYSTACK_RELOCATE (yyvs);
  822. # if YYLSP_NEEDED
  823.     YYSTACK_RELOCATE (yyls);
  824. # endif
  825. # undef YYSTACK_RELOCATE
  826.     if (yyss1 != yyssa)
  827.       YYSTACK_FREE (yyss1);
  828.       }
  829. # endif
  830. #endif /* no yyoverflow */
  831.  
  832.       yyssp = yyss + yysize - 1;
  833.       yyvsp = yyvs + yysize - 1;
  834. #if YYLSP_NEEDED
  835.       yylsp = yyls + yysize - 1;
  836. #endif
  837.  
  838.       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
  839.           (unsigned long int) yystacksize));
  840.  
  841.       if (yyssp >= yyss + yystacksize - 1)
  842.     YYABORT;
  843.     }
  844.  
  845.   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
  846.  
  847.   goto yybackup;
  848.  
  849.  
  850. /*-----------.
  851. | yybackup.  |
  852. `-----------*/
  853. yybackup:
  854.  
  855. /* Do appropriate processing given the current state.  */
  856. /* Read a lookahead token if we need one and don't already have one.  */
  857. /* yyresume: */
  858.  
  859.   /* First try to decide what to do without reference to lookahead token.  */
  860.  
  861.   yyn = yypact[yystate];
  862.   if (yyn == YYFLAG)
  863.     goto yydefault;
  864.  
  865.   /* Not known => get a lookahead token if don't already have one.  */
  866.  
  867.   /* yychar is either YYEMPTY or YYEOF
  868.      or a valid token in external form.  */
  869.  
  870.   if (yychar == YYEMPTY)
  871.     {
  872.       YYDPRINTF ((stderr, "Reading a token: "));
  873.       yychar = YYLEX;
  874.     }
  875.  
  876.   /* Convert token to internal form (in yychar1) for indexing tables with */
  877.  
  878.   if (yychar <= 0)        /* This means end of input. */
  879.     {
  880.       yychar1 = 0;
  881.       yychar = YYEOF;        /* Don't call YYLEX any more */
  882.  
  883.       YYDPRINTF ((stderr, "Now at end of input.\n"));
  884.     }
  885.   else
  886.     {
  887.       yychar1 = YYTRANSLATE (yychar);
  888.  
  889. #if YYDEBUG
  890.      /* We have to keep this `#if YYDEBUG', since we use variables
  891.     which are defined only if `YYDEBUG' is set.  */
  892.       if (yydebug)
  893.     {
  894.       YYFPRINTF (stderr, "Next token is %d (%s",
  895.              yychar, yytname[yychar1]);
  896.       /* Give the individual parser a way to print the precise
  897.          meaning of a token, for further debugging info.  */
  898. # ifdef YYPRINT
  899.       YYPRINT (stderr, yychar, yylval);
  900. # endif
  901.       YYFPRINTF (stderr, ")\n");
  902.     }
  903. #endif
  904.     }
  905.  
  906.   yyn += yychar1;
  907.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
  908.     goto yydefault;
  909.  
  910.   yyn = yytable[yyn];
  911.  
  912.   /* yyn is what to do for this token type in this state.
  913.      Negative => reduce, -yyn is rule number.
  914.      Positive => shift, yyn is new state.
  915.        New state is final state => don't bother to shift,
  916.        just return success.
  917.      0, or most negative number => error.  */
  918.  
  919.   if (yyn < 0)
  920.     {
  921.       if (yyn == YYFLAG)
  922.     goto yyerrlab;
  923.       yyn = -yyn;
  924.       goto yyreduce;
  925.     }
  926.   else if (yyn == 0)
  927.     goto yyerrlab;
  928.  
  929.   if (yyn == YYFINAL)
  930.     YYACCEPT;
  931.  
  932.   /* Shift the lookahead token.  */
  933.   YYDPRINTF ((stderr, "Shifting token %d (%s), ",
  934.           yychar, yytname[yychar1]));
  935.  
  936.   /* Discard the token being shifted unless it is eof.  */
  937.   if (yychar != YYEOF)
  938.     yychar = YYEMPTY;
  939.  
  940.   *++yyvsp = yylval;
  941. #if YYLSP_NEEDED
  942.   *++yylsp = yylloc;
  943. #endif
  944.  
  945.   /* Count tokens shifted since error; after three, turn off error
  946.      status.  */
  947.   if (yyerrstatus)
  948.     yyerrstatus--;
  949.  
  950.   yystate = yyn;
  951.   goto yynewstate;
  952.  
  953.  
  954. /*-----------------------------------------------------------.
  955. | yydefault -- do the default action for the current state.  |
  956. `-----------------------------------------------------------*/
  957. yydefault:
  958.   yyn = yydefact[yystate];
  959.   if (yyn == 0)
  960.     goto yyerrlab;
  961.   goto yyreduce;
  962.  
  963.  
  964. /*-----------------------------.
  965. | yyreduce -- Do a reduction.  |
  966. `-----------------------------*/
  967. yyreduce:
  968.   /* yyn is the number of a rule to reduce with.  */
  969.   yylen = yyr2[yyn];
  970.  
  971.   /* If YYLEN is nonzero, implement the default value of the action:
  972.      `$$ = $1'.
  973.  
  974.      Otherwise, the following line sets YYVAL to the semantic value of
  975.      the lookahead token.  This behavior is undocumented and Bison
  976.      users should not rely upon it.  Assigning to YYVAL
  977.      unconditionally makes the parser a bit smaller, and it avoids a
  978.      GCC warning that YYVAL may be used uninitialized.  */
  979.   yyval = yyvsp[1-yylen];
  980.  
  981. #if YYLSP_NEEDED
  982.   /* Similarly for the default location.  Let the user run additional
  983.      commands if for instance locations are ranges.  */
  984.   yyloc = yylsp[1-yylen];
  985.   YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
  986. #endif
  987.  
  988. #if YYDEBUG
  989.   /* We have to keep this `#if YYDEBUG', since we use variables which
  990.      are defined only if `YYDEBUG' is set.  */
  991.   if (yydebug)
  992.     {
  993.       int yyi;
  994.  
  995.       YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
  996.          yyn, yyrline[yyn]);
  997.  
  998.       /* Print the symbols being reduced, and their result.  */
  999.       for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
  1000.     YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
  1001.       YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
  1002.     }
  1003. #endif
  1004.  
  1005.   switch (yyn) {
  1006.  
  1007. case 1:
  1008. #line 153 "plural.y"
  1009. {
  1010.         if (yyvsp[0].exp == NULL)
  1011.           YYABORT;
  1012.         ((struct parse_args *) arg)->res = yyvsp[0].exp;
  1013.       }
  1014.     break;
  1015. case 2:
  1016. #line 161 "plural.y"
  1017. {
  1018.         yyval.exp = new_exp_3 (qmop, yyvsp[-4].exp, yyvsp[-2].exp, yyvsp[0].exp);
  1019.       }
  1020.     break;
  1021. case 3:
  1022. #line 165 "plural.y"
  1023. {
  1024.         yyval.exp = new_exp_2 (lor, yyvsp[-2].exp, yyvsp[0].exp);
  1025.       }
  1026.     break;
  1027. case 4:
  1028. #line 169 "plural.y"
  1029. {
  1030.         yyval.exp = new_exp_2 (land, yyvsp[-2].exp, yyvsp[0].exp);
  1031.       }
  1032.     break;
  1033. case 5:
  1034. #line 173 "plural.y"
  1035. {
  1036.         yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
  1037.       }
  1038.     break;
  1039. case 6:
  1040. #line 177 "plural.y"
  1041. {
  1042.         yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
  1043.       }
  1044.     break;
  1045. case 7:
  1046. #line 181 "plural.y"
  1047. {
  1048.         yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
  1049.       }
  1050.     break;
  1051. case 8:
  1052. #line 185 "plural.y"
  1053. {
  1054.         yyval.exp = new_exp_2 (yyvsp[-1].op, yyvsp[-2].exp, yyvsp[0].exp);
  1055.       }
  1056.     break;
  1057. case 9:
  1058. #line 189 "plural.y"
  1059. {
  1060.         yyval.exp = new_exp_1 (lnot, yyvsp[0].exp);
  1061.       }
  1062.     break;
  1063. case 10:
  1064. #line 193 "plural.y"
  1065. {
  1066.         yyval.exp = new_exp_0 (var);
  1067.       }
  1068.     break;
  1069. case 11:
  1070. #line 197 "plural.y"
  1071. {
  1072.         if ((yyval.exp = new_exp_0 (num)) != NULL)
  1073.           yyval.exp->val.num = yyvsp[0].num;
  1074.       }
  1075.     break;
  1076. case 12:
  1077. #line 202 "plural.y"
  1078. {
  1079.         yyval.exp = yyvsp[-1].exp;
  1080.       }
  1081.     break;
  1082. }
  1083.  
  1084. #line 705 "bison.simple"
  1085.  
  1086.  
  1087.   yyvsp -= yylen;
  1088.   yyssp -= yylen;
  1089. #if YYLSP_NEEDED
  1090.   yylsp -= yylen;
  1091. #endif
  1092.  
  1093. #if YYDEBUG
  1094.   if (yydebug)
  1095.     {
  1096.       short *yyssp1 = yyss - 1;
  1097.       YYFPRINTF (stderr, "state stack now");
  1098.       while (yyssp1 != yyssp)
  1099.     YYFPRINTF (stderr, " %d", *++yyssp1);
  1100.       YYFPRINTF (stderr, "\n");
  1101.     }
  1102. #endif
  1103.  
  1104.   *++yyvsp = yyval;
  1105. #if YYLSP_NEEDED
  1106.   *++yylsp = yyloc;
  1107. #endif
  1108.  
  1109.   /* Now `shift' the result of the reduction.  Determine what state
  1110.      that goes to, based on the state we popped back to and the rule
  1111.      number reduced by.  */
  1112.  
  1113.   yyn = yyr1[yyn];
  1114.  
  1115.   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  1116.   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  1117.     yystate = yytable[yystate];
  1118.   else
  1119.     yystate = yydefgoto[yyn - YYNTBASE];
  1120.  
  1121.   goto yynewstate;
  1122.  
  1123.  
  1124. /*------------------------------------.
  1125. | yyerrlab -- here on detecting error |
  1126. `------------------------------------*/
  1127. yyerrlab:
  1128.   /* If not already recovering from an error, report this error.  */
  1129.   if (!yyerrstatus)
  1130.     {
  1131.       ++yynerrs;
  1132.  
  1133. #ifdef YYERROR_VERBOSE
  1134.       yyn = yypact[yystate];
  1135.  
  1136.       if (yyn > YYFLAG && yyn < YYLAST)
  1137.     {
  1138.       YYSIZE_T yysize = 0;
  1139.       char *yymsg;
  1140.       int yyx, yycount;
  1141.  
  1142.       yycount = 0;
  1143.       /* Start YYX at -YYN if negative to avoid negative indexes in
  1144.          YYCHECK.  */
  1145.       for (yyx = yyn < 0 ? -yyn : 0;
  1146.            yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
  1147.         if (yycheck[yyx + yyn] == yyx)
  1148.           yysize += yystrlen (yytname[yyx]) + 15, yycount++;
  1149.       yysize += yystrlen ("parse error, unexpected ") + 1;
  1150.       yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
  1151.       yymsg = (char *) YYSTACK_ALLOC (yysize);
  1152.       if (yymsg != 0)
  1153.         {
  1154.           char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
  1155.           yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
  1156.  
  1157.           if (yycount < 5)
  1158.         {
  1159.           yycount = 0;
  1160.           for (yyx = yyn < 0 ? -yyn : 0;
  1161.                yyx < (int) (sizeof (yytname) / sizeof (char *));
  1162.                yyx++)
  1163.             if (yycheck[yyx + yyn] == yyx)
  1164.               {
  1165.             const char *yyq = ! yycount ? ", expecting " : " or ";
  1166.             yyp = yystpcpy (yyp, yyq);
  1167.             yyp = yystpcpy (yyp, yytname[yyx]);
  1168.             yycount++;
  1169.               }
  1170.         }
  1171.           yyerror (yymsg);
  1172.           YYSTACK_FREE (yymsg);
  1173.         }
  1174.       else
  1175.         yyerror ("parse error; also virtual memory exhausted");
  1176.     }
  1177.       else
  1178. #endif /* defined (YYERROR_VERBOSE) */
  1179.     yyerror ("parse error");
  1180.     }
  1181.   goto yyerrlab1;
  1182.  
  1183.  
  1184. /*--------------------------------------------------.
  1185. | yyerrlab1 -- error raised explicitly by an action |
  1186. `--------------------------------------------------*/
  1187. yyerrlab1:
  1188.   if (yyerrstatus == 3)
  1189.     {
  1190.       /* If just tried and failed to reuse lookahead token after an
  1191.      error, discard it.  */
  1192.  
  1193.       /* return failure if at end of input */
  1194.       if (yychar == YYEOF)
  1195.     YYABORT;
  1196.       YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
  1197.           yychar, yytname[yychar1]));
  1198.       yychar = YYEMPTY;
  1199.     }
  1200.  
  1201.   /* Else will try to reuse lookahead token after shifting the error
  1202.      token.  */
  1203.  
  1204.   yyerrstatus = 3;        /* Each real token shifted decrements this */
  1205.  
  1206.   goto yyerrhandle;
  1207.  
  1208.  
  1209. /*-------------------------------------------------------------------.
  1210. | yyerrdefault -- current state does not do anything special for the |
  1211. | error token.                                                       |
  1212. `-------------------------------------------------------------------*/
  1213. yyerrdefault:
  1214. #if 0
  1215.   /* This is wrong; only states that explicitly want error tokens
  1216.      should shift them.  */
  1217.  
  1218.   /* If its default is to accept any token, ok.  Otherwise pop it.  */
  1219.   yyn = yydefact[yystate];
  1220.   if (yyn)
  1221.     goto yydefault;
  1222. #endif
  1223.  
  1224.  
  1225. /*---------------------------------------------------------------.
  1226. | yyerrpop -- pop the current state because it cannot handle the |
  1227. | error token                                                    |
  1228. `---------------------------------------------------------------*/
  1229. yyerrpop:
  1230.   if (yyssp == yyss)
  1231.     YYABORT;
  1232.   yyvsp--;
  1233.   yystate = *--yyssp;
  1234. #if YYLSP_NEEDED
  1235.   yylsp--;
  1236. #endif
  1237.  
  1238. #if YYDEBUG
  1239.   if (yydebug)
  1240.     {
  1241.       short *yyssp1 = yyss - 1;
  1242.       YYFPRINTF (stderr, "Error: state stack now");
  1243.       while (yyssp1 != yyssp)
  1244.     YYFPRINTF (stderr, " %d", *++yyssp1);
  1245.       YYFPRINTF (stderr, "\n");
  1246.     }
  1247. #endif
  1248.  
  1249. /*--------------.
  1250. | yyerrhandle.  |
  1251. `--------------*/
  1252. yyerrhandle:
  1253.   yyn = yypact[yystate];
  1254.   if (yyn == YYFLAG)
  1255.     goto yyerrdefault;
  1256.  
  1257.   yyn += YYTERROR;
  1258.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
  1259.     goto yyerrdefault;
  1260.  
  1261.   yyn = yytable[yyn];
  1262.   if (yyn < 0)
  1263.     {
  1264.       if (yyn == YYFLAG)
  1265.     goto yyerrpop;
  1266.       yyn = -yyn;
  1267.       goto yyreduce;
  1268.     }
  1269.   else if (yyn == 0)
  1270.     goto yyerrpop;
  1271.  
  1272.   if (yyn == YYFINAL)
  1273.     YYACCEPT;
  1274.  
  1275.   YYDPRINTF ((stderr, "Shifting error token, "));
  1276.  
  1277.   *++yyvsp = yylval;
  1278. #if YYLSP_NEEDED
  1279.   *++yylsp = yylloc;
  1280. #endif
  1281.  
  1282.   yystate = yyn;
  1283.   goto yynewstate;
  1284.  
  1285.  
  1286. /*-------------------------------------.
  1287. | yyacceptlab -- YYACCEPT comes here.  |
  1288. `-------------------------------------*/
  1289. yyacceptlab:
  1290.   yyresult = 0;
  1291.   goto yyreturn;
  1292.  
  1293. /*-----------------------------------.
  1294. | yyabortlab -- YYABORT comes here.  |
  1295. `-----------------------------------*/
  1296. yyabortlab:
  1297.   yyresult = 1;
  1298.   goto yyreturn;
  1299.  
  1300. /*---------------------------------------------.
  1301. | yyoverflowab -- parser overflow comes here.  |
  1302. `---------------------------------------------*/
  1303. yyoverflowlab:
  1304.   yyerror ("parser stack overflow");
  1305.   yyresult = 2;
  1306.   /* Fall through.  */
  1307.  
  1308. yyreturn:
  1309. #ifndef yyoverflow
  1310.   if (yyss != yyssa)
  1311.     YYSTACK_FREE (yyss);
  1312. #endif
  1313.   return yyresult;
  1314. }
  1315. #line 207 "plural.y"
  1316.  
  1317.  
  1318. void
  1319. internal_function
  1320. FREE_EXPRESSION (struct expression *exp)
  1321. {
  1322.   if (exp == NULL)
  1323.     return;
  1324.  
  1325.   /* Handle the recursive case.  */
  1326.   switch (exp->nargs)
  1327.     {
  1328.     case 3:
  1329.       FREE_EXPRESSION (exp->val.args[2]);
  1330.       /* FALLTHROUGH */
  1331.     case 2:
  1332.       FREE_EXPRESSION (exp->val.args[1]);
  1333.       /* FALLTHROUGH */
  1334.     case 1:
  1335.       FREE_EXPRESSION (exp->val.args[0]);
  1336.       /* FALLTHROUGH */
  1337.     default:
  1338.       break;
  1339.     }
  1340.  
  1341.   free (exp);
  1342. }
  1343.  
  1344.  
  1345. static int
  1346. yylex (YYSTYPE *lval, const char **pexp)
  1347. {
  1348.   const char *exp = *pexp;
  1349.   int result;
  1350.  
  1351.   while (1)
  1352.     {
  1353.       if (exp[0] == '\0')
  1354.     {
  1355.       *pexp = exp;
  1356.       return YYEOF;
  1357.     }
  1358.  
  1359.       if (exp[0] != ' ' && exp[0] != '\t')
  1360.     break;
  1361.  
  1362.       ++exp;
  1363.     }
  1364.  
  1365.   result = *exp++;
  1366.   switch (result)
  1367.     {
  1368.     case '0': case '1': case '2': case '3': case '4':
  1369.     case '5': case '6': case '7': case '8': case '9':
  1370.       {
  1371.     unsigned long int n = result - '0';
  1372.     while (exp[0] >= '0' && exp[0] <= '9')
  1373.       {
  1374.         n *= 10;
  1375.         n += exp[0] - '0';
  1376.         ++exp;
  1377.       }
  1378.     lval->num = n;
  1379.     result = NUMBER;
  1380.       }
  1381.       break;
  1382.  
  1383.     case '=':
  1384.       if (exp[0] == '=')
  1385.     {
  1386.       ++exp;
  1387.       lval->op = equal;
  1388.       result = EQUOP2;
  1389.     }
  1390.       else
  1391.     result = YYERRCODE;
  1392.       break;
  1393.  
  1394.     case '!':
  1395.       if (exp[0] == '=')
  1396.     {
  1397.       ++exp;
  1398.       lval->op = not_equal;
  1399.       result = EQUOP2;
  1400.     }
  1401.       break;
  1402.  
  1403.     case '&':
  1404.     case '|':
  1405.       if (exp[0] == result)
  1406.     ++exp;
  1407.       else
  1408.     result = YYERRCODE;
  1409.       break;
  1410.  
  1411.     case '<':
  1412.       if (exp[0] == '=')
  1413.     {
  1414.       ++exp;
  1415.       lval->op = less_or_equal;
  1416.     }
  1417.       else
  1418.     lval->op = less_than;
  1419.       result = CMPOP2;
  1420.       break;
  1421.  
  1422.     case '>':
  1423.       if (exp[0] == '=')
  1424.     {
  1425.       ++exp;
  1426.       lval->op = greater_or_equal;
  1427.     }
  1428.       else
  1429.     lval->op = greater_than;
  1430.       result = CMPOP2;
  1431.       break;
  1432.  
  1433.     case '*':
  1434.       lval->op = mult;
  1435.       result = MULOP2;
  1436.       break;
  1437.  
  1438.     case '/':
  1439.       lval->op = divide;
  1440.       result = MULOP2;
  1441.       break;
  1442.  
  1443.     case '%':
  1444.       lval->op = module;
  1445.       result = MULOP2;
  1446.       break;
  1447.  
  1448.     case '+':
  1449.       lval->op = plus;
  1450.       result = ADDOP2;
  1451.       break;
  1452.  
  1453.     case '-':
  1454.       lval->op = minus;
  1455.       result = ADDOP2;
  1456.       break;
  1457.  
  1458.     case 'n':
  1459.     case '?':
  1460.     case ':':
  1461.     case '(':
  1462.     case ')':
  1463.       /* Nothing, just return the character.  */
  1464.       break;
  1465.  
  1466.     case ';':
  1467.     case '\n':
  1468.     case '\0':
  1469.       /* Be safe and let the user call this function again.  */
  1470.       --exp;
  1471.       result = YYEOF;
  1472.       break;
  1473.  
  1474.     default:
  1475.       result = YYERRCODE;
  1476. #if YYDEBUG != 0
  1477.       --exp;
  1478. #endif
  1479.       break;
  1480.     }
  1481.  
  1482.   *pexp = exp;
  1483.  
  1484.   return result;
  1485. }
  1486.  
  1487.  
  1488. static void
  1489. yyerror (const char *str)
  1490. {
  1491.   /* Do nothing.  We don't print error messages here.  */
  1492. }
  1493.